\hypertarget{band__ctrl_8c}{
\section{front\_\-panel/band\_\-ctrl.c File Reference}
\label{band__ctrl_8c}\index{front\_\-panel/band\_\-ctrl.c@{front\_\-panel/band\_\-ctrl.c}}
}
Band control functions.  


{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$avr/io.h$>$}\par
{\tt \#include $<$avr/interrupt.h$>$}\par
{\tt \#include \char`\"{}band\_\-ctrl.h\char`\"{}}\par
{\tt \#include \char`\"{}main.h\char`\"{}}\par
{\tt \#include \char`\"{}eeprom.h\char`\"{}}\par
{\tt \#include \char`\"{}led\_\-control.h\char`\"{}}\par
{\tt \#include \char`\"{}radio\_\-interface.h\char`\"{}}\par
{\tt \#include \char`\"{}sub\_\-menu.h\char`\"{}}\par
{\tt \#include \char`\"{}../global.h\char`\"{}}\par
{\tt \#include \char`\"{}../internal\_\-comm.h\char`\"{}}\par
{\tt \#include \char`\"{}../wmv\_\-bus/bus.h\char`\"{}}\par
{\tt \#include \char`\"{}../wmv\_\-bus/bus\_\-rx\_\-queue.h\char`\"{}}\par
{\tt \#include \char`\"{}../wmv\_\-bus/bus\_\-tx\_\-queue.h\char`\"{}}\par
{\tt \#include \char`\"{}../wmv\_\-bus/bus\_\-commands.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hypertarget{band__ctrl_8c_04e64b2486df76aaf97baf61ff70896a}{
void \hyperlink{band__ctrl_8c_04e64b2486df76aaf97baf61ff70896a}{band\_\-ctrl\_\-send\_\-band\_\-data\_\-to\_\-bus} (unsigned char band\_\-portion)}
\label{band__ctrl_8c_04e64b2486df76aaf97baf61ff70896a}

\begin{CompactList}\small\item\em Send the output string for the current band to the bus. \item\end{CompactList}\item 
void \hyperlink{band__ctrl_8c_95c96792b3186a41830050229812285e}{band\_\-ctrl\_\-load\_\-band} (unsigned char band)
\begin{CompactList}\small\item\em Function will load a band from the EEPROM into the current\_\-band struct. \item\end{CompactList}\item 
void \hyperlink{band__ctrl_8c_b5eb49c98d55e709f5fb8d2fe16db418}{band\_\-ctrl\_\-change\_\-band\_\-portion} (unsigned char band\_\-portion)
\begin{CompactList}\small\item\em Function will send out new band portion settings for the current selected band $\ast$. \item\end{CompactList}\item 
void \hyperlink{band__ctrl_8c_62c3930057e2cfe14c33d35ac57cfb56}{band\_\-ctrl\_\-change\_\-band} (unsigned char band)
\begin{CompactList}\small\item\em Function used to change band. \item\end{CompactList}\item 
\hypertarget{band__ctrl_8c_7081025e6923a7a4d8d35e61144f494e}{
void \hyperlink{band__ctrl_8c_7081025e6923a7a4d8d35e61144f494e}{band\_\-ctrl\_\-deactivate\_\-all} (void)}
\label{band__ctrl_8c_7081025e6923a7a4d8d35e61144f494e}

\begin{CompactList}\small\item\em Function which will deactiavate all band outptus, BUS\_\-CMD\_\-DRIVER\_\-DEACTIVATE\_\-ALL\_\-BAND\_\-OUTPUTS. \item\end{CompactList}\item 
\hypertarget{band__ctrl_8c_8318112bb7a0d18e57bd33c2d27d0d95}{
void \hyperlink{band__ctrl_8c_8318112bb7a0d18e57bd33c2d27d0d95}{band\_\-ctrl\_\-load\_\-band\_\-limits} (void)}
\label{band__ctrl_8c_8318112bb7a0d18e57bd33c2d27d0d95}

\begin{CompactList}\small\item\em Loads the band limits into the band limits struct. \item\end{CompactList}\item 
unsigned int \hyperlink{band__ctrl_8c_7000f5c890a6f56846688316de9a9d46}{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-low} (unsigned char band)
\begin{CompactList}\small\item\em Retrieve the lower frequency limit of the low band limit. \item\end{CompactList}\item 
unsigned int \hyperlink{band__ctrl_8c_3081981043c523a48c93a748fafab483}{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-high} (unsigned char band)
\begin{CompactList}\small\item\em Retrieve the higher frequency limit of the low band limit. \item\end{CompactList}\item 
unsigned int \hyperlink{band__ctrl_8c_15a19bda71651bbce5cdad2a09bf595e}{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-low} (unsigned char band)
\begin{CompactList}\small\item\em Retrieve the lower frequency limit of the high band limit. \item\end{CompactList}\item 
unsigned int \hyperlink{band__ctrl_8c_99e7008d39a767444fef44c28eac8e3c}{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-high} (unsigned char band)
\begin{CompactList}\small\item\em Retrieve the higher frequency limit of the high band limit. \item\end{CompactList}\item 
unsigned char $\ast$ \hyperlink{band__ctrl_8c_5c38d45679e5b24438dbac6f5c531a72}{band\_\-ctrl\_\-get\_\-high\_\-output\_\-str} (void)
\begin{CompactList}\small\item\em Retrieve the higher frequency output string, of max length BAND\_\-OUTPUT\_\-STR\_\-SIZE. \item\end{CompactList}\item 
unsigned char $\ast$ \hyperlink{band__ctrl_8c_78d1192f01a3f645e2f0af0730eb0d8a}{band\_\-ctrl\_\-get\_\-low\_\-output\_\-str} (void)
\begin{CompactList}\small\item\em Retrieve the lower frequency output string, of max length BAND\_\-OUTPUT\_\-STR\_\-SIZE. \item\end{CompactList}\item 
unsigned char \hyperlink{band__ctrl_8c_6bf2ce0c200183ad067d41b7051a9050}{band\_\-ctrl\_\-get\_\-portion} (void)
\begin{CompactList}\small\item\em Retrieve which band portion we are currently at. \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hypertarget{band__ctrl_8c_dddd969c7e4f721ab1659c1ab3a946ce}{
\hyperlink{structstruct__band}{struct\_\-band} \hyperlink{band__ctrl_8c_dddd969c7e4f721ab1659c1ab3a946ce}{current\_\-band}}
\label{band__ctrl_8c_dddd969c7e4f721ab1659c1ab3a946ce}

\begin{CompactList}\small\item\em Contains the current band information. \item\end{CompactList}\item 
\hypertarget{band__ctrl_8c_99322d1503c4eddf338c256c99fb52e2}{
unsigned char \hyperlink{band__ctrl_8c_99322d1503c4eddf338c256c99fb52e2}{current\_\-band\_\-activated\_\-outputs} \mbox{[}BAND\_\-OUTPUT\_\-STR\_\-SIZE\mbox{]}}
\label{band__ctrl_8c_99322d1503c4eddf338c256c99fb52e2}

\begin{CompactList}\small\item\em Array which we use to keep track of which devices we have been activating outputs on. \item\end{CompactList}\item 
\hypertarget{band__ctrl_8c_95dd3b6a390eb053adecba3f5fee3d5d}{
unsigned char \hyperlink{band__ctrl_8c_95dd3b6a390eb053adecba3f5fee3d5d}{current\_\-band\_\-activated\_\-outputs\_\-length} = 0}
\label{band__ctrl_8c_95dd3b6a390eb053adecba3f5fee3d5d}

\begin{CompactList}\small\item\em The number of devices we have activated outputs on. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Band control functions. 

\begin{Desc}
\item[Author:]Mikael Larsmark, SM2WMV \end{Desc}
\begin{Desc}
\item[Date:]2010-01-25 

\begin{Code}\begin{verbatim} #include "front_panel/band_ctrl.c" 
\end{verbatim}
\end{Code}

 \end{Desc}


Definition in file \hyperlink{band__ctrl_8c-source}{band\_\-ctrl.c}.

\subsection{Function Documentation}
\hypertarget{band__ctrl_8c_62c3930057e2cfe14c33d35ac57cfb56}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-change\_\-band@{band\_\-ctrl\_\-change\_\-band}}
\index{band\_\-ctrl\_\-change\_\-band@{band\_\-ctrl\_\-change\_\-band}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-change\_\-band}]{\setlength{\rightskip}{0pt plus 5cm}void band\_\-ctrl\_\-change\_\-band (unsigned char {\em band})}}
\label{band__ctrl_8c_62c3930057e2cfe14c33d35ac57cfb56}


Function used to change band. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em band}]The band we wish to change to \end{description}
\end{Desc}


Definition at line 145 of file band\_\-ctrl.c.

References antenna\_\-ctrl\_\-change\_\-rx\_\-ant(), antenna\_\-ctrl\_\-deactivate\_\-all(), antenna\_\-ctrl\_\-deactivate\_\-all\_\-rx\_\-band(), antenna\_\-ctrl\_\-select\_\-default\_\-ant(), antenna\_\-ctrl\_\-send\_\-rx\_\-ant\_\-band\_\-data\_\-to\_\-bus(), band\_\-ctrl\_\-deactivate\_\-all(), band\_\-ctrl\_\-load\_\-band(), band\_\-ctrl\_\-send\_\-band\_\-data\_\-to\_\-bus(), struct\_\-status::current\_\-band\_\-portion, struct\_\-status::current\_\-display, CURRENT\_\-DISPLAY\_\-ANTENNA\_\-INFO, struct\_\-status::current\_\-display\_\-level, CURRENT\_\-DISPLAY\_\-LOGO, CURRENT\_\-DISPLAY\_\-MENU\_\-SYSTEM, CURRENT\_\-DISPLAY\_\-SHUTDOWN\_\-VIEW, DISPLAY\_\-LEVEL\_\-BAND, FUNC\_\-STATUS\_\-RXANT, struct\_\-status::function\_\-status, INHIBIT\_\-NOT\_\-OK\_\-TO\_\-SEND\_\-RADIO\_\-TX, KNOB\_\-FUNCTION\_\-AUTO, led\_\-set\_\-band(), led\_\-set\_\-band\_\-none(), led\_\-set\_\-rx\_\-ant(), led\_\-set\_\-rxant(), led\_\-set\_\-tx\_\-ant(), LED\_\-STATE\_\-OFF, main\_\-get\_\-inhibit\_\-state(), main\_\-update\_\-display(), main\_\-update\_\-ptt\_\-status(), struct\_\-status::new\_\-band, struct\_\-status::selected\_\-ant, struct\_\-status::selected\_\-band, struct\_\-status::selected\_\-rx\_\-antenna, set\_\-knob\_\-function(), and status.

Referenced by event\_\-internal\_\-comm\_\-parse\_\-message(), event\_\-poll\_\-buttons(), and main().\hypertarget{band__ctrl_8c_b5eb49c98d55e709f5fb8d2fe16db418}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-change\_\-band\_\-portion@{band\_\-ctrl\_\-change\_\-band\_\-portion}}
\index{band\_\-ctrl\_\-change\_\-band\_\-portion@{band\_\-ctrl\_\-change\_\-band\_\-portion}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-change\_\-band\_\-portion}]{\setlength{\rightskip}{0pt plus 5cm}void band\_\-ctrl\_\-change\_\-band\_\-portion (unsigned char {\em band\_\-portion})}}
\label{band__ctrl_8c_b5eb49c98d55e709f5fb8d2fe16db418}


Function will send out new band portion settings for the current selected band $\ast$. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em band\_\-portion}]The current band portion \end{description}
\end{Desc}


Definition at line 139 of file band\_\-ctrl.c.

References band\_\-ctrl\_\-send\_\-band\_\-data\_\-to\_\-bus().

Referenced by event\_\-aux2\_\-button\_\-pressed(), and main().\hypertarget{band__ctrl_8c_5c38d45679e5b24438dbac6f5c531a72}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-get\_\-high\_\-output\_\-str@{band\_\-ctrl\_\-get\_\-high\_\-output\_\-str}}
\index{band\_\-ctrl\_\-get\_\-high\_\-output\_\-str@{band\_\-ctrl\_\-get\_\-high\_\-output\_\-str}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-get\_\-high\_\-output\_\-str}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char$\ast$ band\_\-ctrl\_\-get\_\-high\_\-output\_\-str (void)}}
\label{band__ctrl_8c_5c38d45679e5b24438dbac6f5c531a72}


Retrieve the higher frequency output string, of max length BAND\_\-OUTPUT\_\-STR\_\-SIZE. 

\begin{Desc}
\item[Returns:]The output string \end{Desc}


Definition at line 253 of file band\_\-ctrl.c.

References struct\_\-band::band\_\-high\_\-output\_\-str.\hypertarget{band__ctrl_8c_99e7008d39a767444fef44c28eac8e3c}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-get\_\-high\_\-portion\_\-high@{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-high}}
\index{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-high@{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-high}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-high}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int band\_\-ctrl\_\-get\_\-high\_\-portion\_\-high (unsigned char {\em band})}}
\label{band__ctrl_8c_99e7008d39a767444fef44c28eac8e3c}


Retrieve the higher frequency limit of the high band limit. 

\begin{Desc}
\item[Returns:]The frequency in kHz \end{Desc}


Definition at line 247 of file band\_\-ctrl.c.

References band\_\-limits.

Referenced by radio\_\-freq\_\-to\_\-band(), and radio\_\-get\_\-band\_\-portion().\hypertarget{band__ctrl_8c_15a19bda71651bbce5cdad2a09bf595e}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-get\_\-high\_\-portion\_\-low@{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-low}}
\index{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-low@{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-low}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-get\_\-high\_\-portion\_\-low}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int band\_\-ctrl\_\-get\_\-high\_\-portion\_\-low (unsigned char {\em band})}}
\label{band__ctrl_8c_15a19bda71651bbce5cdad2a09bf595e}


Retrieve the lower frequency limit of the high band limit. 

\begin{Desc}
\item[Returns:]The frequency in kHz \end{Desc}


Definition at line 241 of file band\_\-ctrl.c.

References band\_\-limits.

Referenced by radio\_\-get\_\-band\_\-portion().\hypertarget{band__ctrl_8c_78d1192f01a3f645e2f0af0730eb0d8a}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-get\_\-low\_\-output\_\-str@{band\_\-ctrl\_\-get\_\-low\_\-output\_\-str}}
\index{band\_\-ctrl\_\-get\_\-low\_\-output\_\-str@{band\_\-ctrl\_\-get\_\-low\_\-output\_\-str}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-get\_\-low\_\-output\_\-str}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char$\ast$ band\_\-ctrl\_\-get\_\-low\_\-output\_\-str (void)}}
\label{band__ctrl_8c_78d1192f01a3f645e2f0af0730eb0d8a}


Retrieve the lower frequency output string, of max length BAND\_\-OUTPUT\_\-STR\_\-SIZE. 

\begin{Desc}
\item[Returns:]The output string \end{Desc}


Definition at line 259 of file band\_\-ctrl.c.

References struct\_\-band::band\_\-low\_\-output\_\-str.\hypertarget{band__ctrl_8c_3081981043c523a48c93a748fafab483}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-get\_\-low\_\-portion\_\-high@{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-high}}
\index{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-high@{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-high}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-high}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int band\_\-ctrl\_\-get\_\-low\_\-portion\_\-high (unsigned char {\em band})}}
\label{band__ctrl_8c_3081981043c523a48c93a748fafab483}


Retrieve the higher frequency limit of the low band limit. 

\begin{Desc}
\item[Returns:]The frequency in kHz \end{Desc}


Definition at line 235 of file band\_\-ctrl.c.

References band\_\-limits.

Referenced by radio\_\-get\_\-band\_\-portion().\hypertarget{band__ctrl_8c_7000f5c890a6f56846688316de9a9d46}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-get\_\-low\_\-portion\_\-low@{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-low}}
\index{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-low@{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-low}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-get\_\-low\_\-portion\_\-low}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int band\_\-ctrl\_\-get\_\-low\_\-portion\_\-low (unsigned char {\em band})}}
\label{band__ctrl_8c_7000f5c890a6f56846688316de9a9d46}


Retrieve the lower frequency limit of the low band limit. 

\begin{Desc}
\item[Returns:]The frequency in kHz \end{Desc}


Definition at line 229 of file band\_\-ctrl.c.

References band\_\-limits.

Referenced by radio\_\-freq\_\-to\_\-band(), and radio\_\-get\_\-band\_\-portion().\hypertarget{band__ctrl_8c_6bf2ce0c200183ad067d41b7051a9050}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-get\_\-portion@{band\_\-ctrl\_\-get\_\-portion}}
\index{band\_\-ctrl\_\-get\_\-portion@{band\_\-ctrl\_\-get\_\-portion}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-get\_\-portion}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char band\_\-ctrl\_\-get\_\-portion (void)}}
\label{band__ctrl_8c_6bf2ce0c200183ad067d41b7051a9050}


Retrieve which band portion we are currently at. 

\begin{Desc}
\item[Returns:]BAND\_\-LOW, BAND\_\-HIGH or BAND\_\-UNDEFINED \end{Desc}


Definition at line 265 of file band\_\-ctrl.c.

References struct\_\-runtime\_\-settings::band\_\-change\_\-mode, BAND\_\-CHANGE\_\-MODE\_\-AUTO, BAND\_\-CHANGE\_\-MODE\_\-MANUAL, struct\_\-status::current\_\-band\_\-portion, radio\_\-get\_\-band\_\-portion(), RADIO\_\-INTERFACE\_\-BCD, radio\_\-interface\_\-get\_\-interface(), runtime\_\-settings, and status.\hypertarget{band__ctrl_8c_95c96792b3186a41830050229812285e}{
\index{band\_\-ctrl.c@{band\_\-ctrl.c}!band\_\-ctrl\_\-load\_\-band@{band\_\-ctrl\_\-load\_\-band}}
\index{band\_\-ctrl\_\-load\_\-band@{band\_\-ctrl\_\-load\_\-band}!band_ctrl.c@{band\_\-ctrl.c}}
\subsubsection[{band\_\-ctrl\_\-load\_\-band}]{\setlength{\rightskip}{0pt plus 5cm}void band\_\-ctrl\_\-load\_\-band (unsigned char {\em band})}}
\label{band__ctrl_8c_95c96792b3186a41830050229812285e}


Function will load a band from the EEPROM into the current\_\-band struct. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em band}]The index of the band we wish to load from the EEPROM \end{description}
\end{Desc}


Definition at line 126 of file band\_\-ctrl.c.

References antenna\_\-ctrl\_\-ant\_\-read\_\-eeprom(), eeprom\_\-get\_\-band\_\-data(), and sub\_\-menu\_\-load().

Referenced by band\_\-ctrl\_\-change\_\-band().